<?php

namespace App\Http\Requests\Backend\Loan;

use Illuminate\Foundation\Http\FormRequest;

class LoanResultListRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'time_start' => 'bail|nullable|date',
            'time_end' => 'bail|nullable|after_or_equal:time_start',
            'page_size' => 'bail|nullable|numeric',
            'page' => 'bail|nullable|numeric',
        ];
    }


    public function messages()
    {
        return [
            'time_start.date' => '时间开始节点必须是一个日期',
            'time_end.date' => '时间结束节点必须是一个日期',
            'time_end.after' => '时间结束节点必须大于等于开始节点',
            'page_size.numeric' => '每页数量必须是一个数字',
            'page.numeric' => '页数必须是一个数字',
        ];
    }
}
